package com.ruoyi.swla2.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.swla2.domain.RealtimegatherdataXb;
import com.ruoyi.swla2.service.IRealtimegatherdataXbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 实时数据采集（远传小）Controller
 * 
 * @author gdqt
 * @date 2025-04-16
 */
@RestController
@RequestMapping("/swla2/xb")
public class RealtimegatherdataXbController extends BaseController
{
    @Autowired
    private IRealtimegatherdataXbService realtimegatherdataXbService;

    /**
     * 查询实时数据采集（远传小）列表
     */
    @PreAuthorize("@ss.hasPermi('swla2:xb:list')")
    @GetMapping("/list")
    public TableDataInfo list(RealtimegatherdataXb realtimegatherdataXb)
    {
        startPage();
        List<RealtimegatherdataXb> list = realtimegatherdataXbService.selectRealtimegatherdataXbList(realtimegatherdataXb);
        return getDataTable(list);
    }

    /**
     * 导出实时数据采集（远传小）列表
     */
    @PreAuthorize("@ss.hasPermi('swla2:xb:export')")
    @Log(title = "实时数据采集（远传小）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RealtimegatherdataXb realtimegatherdataXb)
    {
        List<RealtimegatherdataXb> list = realtimegatherdataXbService.selectRealtimegatherdataXbList(realtimegatherdataXb);
        ExcelUtil<RealtimegatherdataXb> util = new ExcelUtil<RealtimegatherdataXb>(RealtimegatherdataXb.class);
        util.exportExcel(response, list, "实时数据采集（远传小）数据");
    }



    /**
     * 新增实时数据采集（远传小）
     */
    @PreAuthorize("@ss.hasPermi('swla2:xb:add')")
    @Log(title = "实时数据采集（远传小）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RealtimegatherdataXb realtimegatherdataXb)
    {
        return toAjax(realtimegatherdataXbService.insertRealtimegatherdataXb(realtimegatherdataXb));
    }

}
